package com.zx.job.mapper;

import Job.Dto.CategoryDto;
import Job.Dto.JobDto;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CategoryMapper {
    @Select("select * from categories")
    List<CategoryDto> findALl();

    @Insert("insert into categories(name) values(#{name})")
    void addCategory(CategoryDto categoryDto);

    @Delete("delete from categories where id = #{id}")
    void deleteCategory(@Param("id") Integer id);

    @Update("update categories set name = #{name} where id = #{id}")
    void updateCategory(CategoryDto categoryDto);

    @Select("select * from categories where name like '%${name}%'")
    List<CategoryDto> findByName(@Param("name") String name);

    @Select("select name from categories where id = #{id}")
    String findNameById(Integer id);

    @Select("select * from categories")
    List<CategoryDto> getAllCategories();

    @Select("select id from categories where name = #{name}")
    int getIdByName(String name);


}
